Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotrod Containerized #694

Merged
merged 4 commits into from
Feb 19, 2018
Merged

Conversation

gbaufake
Copy link
Contributor

@gbaufake gbaufake commented Feb 10, 2018

Hello Jaeger,
I took the Hotrod example and tried to containerize it.

The odd behavior that is hard to predict is the random UDP port each time the container spins up

hotrod_1 | 2018-02-10T00:39:34.927Z ERROR log/logger.go:42 write udp 127.0.0.1:49372->127.0.0.1:6831: write: connection refused {"service": "frontend"}

hotrod_1 | 2018-02-10T00:41:49.254Z ERROR log/logger.go:42 write udp 127.0.0.1:46555->127.0.0.1:6831: write: connection refused {"service": "frontend"}

Is there some way to use one UDP port?

Best Regards,
Guilherme Baufaker Rêgo

@coveralls
Copy link

coveralls commented Feb 10, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling d5250a6 on gbaufake:hotrod-docker into 9fe8cc8 on jaegertracing:master.

Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbaufake thanks! Just some minor things.

@@ -0,0 +1,4 @@
FROM alpine
Copy link
Member

@pavolloffay pavolloffay Feb 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the consistency could you please:

  • use from scratch
  • COPY collector-linux /go/bin/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dockerfile should be in examples/hotrod directory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pavolloffay is this collector-linux folder in jaeger project? I didn't find it

@@ -0,0 +1,4 @@
FROM alpine
EXPOSE 8080
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should expose more ports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What ports else do I need to export?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you run all it prints all used ports

@@ -0,0 +1,41 @@
# Hot R.O.D. - Rides on Demand - Containerized Version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why new directory hotrod-containerized?

it can live in examples/hotrod and just add instructions to the original readme

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, I'd prefer all in one directory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Changing to one hotrod directory

FROM alpine
EXPOSE 8080
COPY hotrod /
ENTRYPOINT ./main all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows using only all command. Maybe it's better to use just CMD with all

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fwiw I never tested HotRod as individual processes

- "8081:8081"
- "8082:8082"
- "8083:8083"
links:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want compose file for this at all?

If so could you please remove links?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the author comments it does look like compose has some issues with ports. I would split it in a separate PR, assuming we even need it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yurishkuro @pavolloffay I used docker-compose as "quick and easy way" to create booth jaegertracing/all-in-one container and jaegertracing/hotrod.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 let's go with dockerfile and then add compose if necessary

@yurishkuro
Copy link
Member

How will we test that the generated image is operational?

@pavolloffay
Copy link
Member

How will we test that the generated image is operational?

We could have similar tests to build-all-in-one-image.sh. Build the image, start it and curl an endpoint.

@gbaufake gbaufake force-pushed the hotrod-docker branch 2 times, most recently from 0398563 to 4e0bf0a Compare February 14, 2018 16:06
@gbaufake
Copy link
Contributor Author

gbaufake commented Feb 14, 2018

@pavolloffay and @yurishkuro I moved everything to Hotrod folder and adjusted minor things on Dockerfile.
Can you guys check why it uses a different UDP port to connect to Jaeger on 6831?

Examples:
write udp 127.0.0.1:46555->127.0.0.1:6831: write: connection refused {"service": "frontend"}
write udp 127.0.0.1:49372->127.0.0.1:6831: write: connection refused {"service": "frontend"}
write udp 127.0.0.1:35316->127.0.0.1:6831: write: connection refused {"service": "frontend"}
write udp 127.0.0.1:43547->127.0.0.1:6831: write: connection refused {"service": "frontend"}


```
chmod +x ./create-image.sh
./create-image.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x flag can be set and recorded in git. If not, the instruction can be sh ./create-image.sh



# HotROD on Containerized Version
## Requirements
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bit confusing - the point is to let people run from published containers, is it not? In which case go is not a requirement. I think the instruction on how to run should be around L34. Basically think about it holistically - if someone who doesn't even know Go but wants to play with hotrod/jaeger, we should have instructions right at the top, and then below "if you want to build from source then ... (L34-39)"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove everything and just keep two docker run commands :)



[hotrod-tutorial]: https://medium.com/@YuriShkuro/take-opentracing-for-a-hotrod-ride-f6e3141f7941
[hotrod-openshift]: https://blog.openshift.com/openshift-commons-briefing-82-distributed-tracing-with-jaeger-prometheus-on-kubernetes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove dups in L45-46

make install
cd $GOPATH/src/github.com/jaegertracing/jaeger/examples/hotrod
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o collector-linux main.go
docker build -t jaegertracing/hotrod -f Dockerfile .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this won't be enough, we need to add this to Travis build and publish to docker hub along with other images.

@pavolloffay how would you like to proceed here? This might be getting a bit more involved for @gbaufake who is new to this repo. We could merge this (without README changes) and then make the build changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, We can merge this with dockerfile only. Then I can add publish and test for it.

Rather then this script we could add make rules, otherwise there will be some repetition here and in the main makefile.

@@ -0,0 +1,4 @@
FROM scratch
EXPOSE 8080
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are still some ports missing, look at logs when you start all

@@ -0,0 +1,4 @@
FROM scratch
EXPOSE 8080
COPY . /
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add only specific files and keed the name hotrod-demo?



# HotROD on Containerized Version
## Requirements
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove everything and just keep two docker run commands :)

Guilherme Baufaker Rêgo added 3 commits February 14, 2018 18:43
Signed-off-by: Guilherme Baufaker Rêgo <gbaufake@redhat.com>
Signed-off-by: Guilherme Baufaker Rêgo <gbaufake@redhat.com>
and some minor adjustments on Dockerfile

Signed-off-by: Guilherme Baufaker Rêgo <gbaufake@redhat.com>
@gbaufake
Copy link
Contributor Author

@pavolloffay @yurishkuro I have made the modifications that you asked.
Any other changes required?

cd $GOPATH/src/github.com/jaegertracing/jaeger
make install
cd $GOPATH/src/github.com/jaegertracing/jaeger/examples/hotrod
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o collector-linux main.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: collector-linux => hotrod-linux

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed in d5250a6

FROM scratch
EXPOSE 8080 8081 8082 8083
COPY collector-linux /
CMD ["./collector-linux", "all"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: collector-linux => hotrod-linux

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed in d5250a6




# HotROD on Containerized Version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if we didn't change the readme at this time. The first docker command won't run since the hotrod image is not actually published.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the changes README in d5250a6

- exposing more ports on Dockerfile
and copy only binary to Dockerfile

Signed-off-by: Guilherme Baufaker Rêgo <gbaufake@redhat.com>
@pavolloffay
Copy link
Member

@gbaufake thanks

@pavolloffay pavolloffay merged commit a631623 into jaegertracing:master Feb 19, 2018
@pavolloffay
Copy link
Member

Static files are not present in the image. I am creating a fix for it.

@gbaufake
Copy link
Contributor Author

gbaufake commented Feb 19, 2018

@pavolloffay
Thanks for merging.
Maybe it was caused when I switched from the whole folder just to binary one;
Can you check the UDP ports used to connect to Jaeger?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants